﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditPostingDetails.aspx.cs" Inherits="_Default" MasterPageFile="~/Student/Student.master" Title = "Edit Posting Page"%>


<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxUploadControl" tagprefix="dx" %>


<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" >
    <style type="text/css">
        #mainContainer td.buttonCell {
            padding-top: 15px;
        }    
        #mainContainer td.caption {
            padding-right: 5px; 
            padding-top: 4px; 
            vertical-align: top;
        }    
        #mainContainer td.content {
            padding-bottom: 20px;
        }
        #mainContainer td.imagePreviewCell {
            border: solid 2px gray;        
            width: 110px;
            height: 115px;
            /*if IE*/	
	        height:expression("110px");
            text-align: center;
        }
        #mainContainer td.note {
            text-align: left;
            padding-top: 1px;
        }
        .style4
        {
            width: 53px;
        }
        .style5
        {
            width: 100px;
        }
        .style6
        {
            width: 688px;
        }
        .style7
        {
            width: 500px;
        }
        .style8
        {
            height: 101px;
        }
        </style>
    <script type="text/javascript">
    // <![CDATA[
        function Uploader_OnUploadStart() {
            btnUpload.SetEnabled(false);
        }
        function Uploader_OnFileUploadComplete(args) {
            var imgSrc = aspxPreviewImgSrc;
            if (args.isValid) {
                var date = new Date();
                imgSrc = "UploadImages/" + args.callbackData + "?dx=" + date.getTime();
            }
            getPreviewImageElement().src = imgSrc;  
        }
        function Uploader_OnFilesUploadComplete(args) {
            UpdateUploadButton();
        }
        function UpdateUploadButton() {
            btnUpload.SetEnabled(uploader.GetText(0) != "");
        }
        function getPreviewImageElement() {
            return document.getElementById("previewImage");
        }        
    // ]]> 
    </script>

    <asp:MultiView ID="mulviwEditPostingDetails" runat="server">
        <asp:View ID="viwEditPosting" runat="server">
        <dx:ASPxLabel ID="lbError" runat="server" 
              CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
              ForeColor="Red">
        </dx:ASPxLabel>
&nbsp;<table ID="mainContainer" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td align="center" class="content" valign="top">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="center" style="padding-right: 20px; vertical-align: top;">
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="caption">
                                                <dx:ASPxLabel ID="ASPxLabel1" runat="server" 
                                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                                                    Text="Select Image:">
                                                </dx:ASPxLabel>
                                            </td>
                                            <td>
                                                <dx:ASPxUploadControl ID="uplImage" runat="server" 
                                                    ClientInstanceName="uploader" CssFilePath="~/App_Themes/DevEx/{0}/styles.css" 
                                                    CssPostfix="DevEx" onfileuploadcomplete="uplImage_FileUploadComplete" 
                                                    ShowProgressPanel="True" Size="35" 
                                                    SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" UploadMode="Advanced">
                                                    <ValidationSettings allowedfileextensions=".jpg, .jpeg, .jpe, .gif" 
                                                        maxfilesize="4194304" MultiSelectionErrorText="Attention!

                                                The following {0} files are invalid because they exceed the allowed file size ({1}) or their extensions are not allowed. These files have been removed from selection, so they will not be uploaded. 

                                                {2}">
                                                    </ValidationSettings>
                                                    <clientsideevents FilesUploadComplete="function(s, e) { Uploader_OnFilesUploadComplete(e); }" 
                                                        FileUploadComplete="function(s, e) { Uploader_OnFileUploadComplete(e); }" 
                                                        fileuploadstart="function(s, e) { Uploader_OnUploadStart(); }" 
                                                        textchanged="function(s, e) { UpdateUploadButton(); }" />
                                                </dx:ASPxUploadControl>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td class="note">
                                                <dx:ASPxLabel ID="ASPxLabel2" runat="server" 
                                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                                                    Text="Allowed image types: jpeg, gif">
                                                </dx:ASPxLabel>
                                                <br />
                                                <dx:ASPxLabel ID="ASPxLabel3" runat="server" 
                                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                                                    Text="Maximum file size: 4Mb">
                                                </dx:ASPxLabel>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="center" class="buttonCell" colspan="2">
                                                <dx:ASPxButton ID="btnUpload" runat="server" AutoPostBack="False" 
                                                    CausesValidation="False" ClientEnabled="False" ClientInstanceName="btnUpload" 
                                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" 
                                                    Text="Upload" Width="100px">                                                                                                      
                                                    <ClientSideEvents Click="function(s, e) {
	                                                                                            uploader.Upload();
                                                                                            }" />
                                                </dx:ASPxButton>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td align="center" class="imagePreviewCell">
                                    <table border="0px" style="width:100%;">
                                        <tr>
                                            <td>
                                                <dx:ASPxImage ID="previewImage" runat="server" 
                                                    ClientInstanceName="previewImage" Height="100px" Width="100px">
                                                </dx:ASPxImage>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <dx:ASPxLabel ID="ASPxLabel7" runat="server" 
                                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                                                    Text="Old painting">
                                                </dx:ASPxLabel>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                    <td align="center" class="imagePreviewCell">
                                        <table border="0px" style="width:100%; height: 117px;">
                                            <tr>
                                                <td class="style8">
                                                    <img src="../Images/ImagePreview.gif" id="previewImage" alt="" />
                                                 </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <dx:ASPxLabel ID="ASPxLabel8" runat="server" 
                                                        CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                                                        Text="New painting">
                                                    </dx:ASPxLabel>
                                                </td>
                                            </tr>
                                        </table>
                                </td>
                            </tr>
                        </table>
                    </td>                    
                </tr>
            </table>
            <table class="style6">
                <tr>
                    <td class="style4">
                        <dx:ASPxLabel ID="ASPxLabel4" runat="server" 
                            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                            Text="Description:">
                        </dx:ASPxLabel>
                    </td>
                    <td class="style7">
                        <dx:ASPxMemo ID="memoDescription" runat="server" 
                            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                            Height="150px" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" 
                            style="margin-left: 0px" Width="100%">
                            <ValidationSettings Display="Dynamic" SetFocusOnError="True">
                                <RequiredField ErrorText="Description not null!" IsRequired="True" />
                            </ValidationSettings>
                        </dx:ASPxMemo>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        <dx:ASPxLabel ID="ASPxLabel5" runat="server" 
                            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                            Text="Price:">
                        </dx:ASPxLabel>
                    </td>
                    <td class="style7">
                        <table style="width:100%;">
                            <tr>
                                <td class="style5">
                                    <dx:ASPxTextBox ID="txtPrice" runat="server" 
                                        CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                                        SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" Width="100px">
                                        <MaskSettings ErrorText="Price invalid!" 
                                            Mask="&lt;0..999999g&gt;.&lt;000..999&gt;" />
                                        <ValidationSettings Display="Dynamic">
                                            <RegularExpression ErrorText="Price must be number!" />
                                        </ValidationSettings>
                                    </dx:ASPxTextBox>
                                </td>
                                <td>
                                    VNĐ</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        <dx:ASPxLabel ID="ASPxLabel6" runat="server" 
                            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" Text="Date:">
                        </dx:ASPxLabel>
                    </td>
                    <td class="style7">
                        <dx:ASPxTextBox ID="txtDate" runat="server" 
                            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                            ReadOnly="True" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" 
                            Width="170px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        &nbsp;</td>
                    <td class="style7">
                        <dx:ASPxButton ID="btUpdate" runat="server" 
                            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
                            onclick="btUpdate_Click" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css" 
                            Text="Update" AutoPostBack="False">
                        </dx:ASPxButton>
                    </td>
                </tr>
            </table>
        </asp:View>
        <asp:View ID="viwError" runat="server">
            <table width=100%>
                <tr>
                    <td align="center">
                        <asp:Label ID="lbStatus" runat="server" ForeColor="Red">
                        </asp:Label>
                    </td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
      <script type="text/javascript">
        // <![CDATA[
              var aspxPreviewImgSrc = getPreviewImageElement().src;
        // ]]> 
      </script>  
</asp:Content>
